How to Setup and Run Jenkins
Jenkins is a specialised tool that is designed to provide software teams from all sorts of backgrounds with the necessary capabilities to build and refine their source code in the best possible way.
- Introduction
- Login to PWD
- Run Jenkins docker
- Get Jenkins password
- Access Jenkins GUI
- Install the plugins
- Jenkins project types
- Add global credentials
- Create a new Jenkins job
- Add git address and credentials
- Understand Pipeline format in Jenkinsfile
- Create Jenkinsfile
- Trigger the pipeline job
- Check out the pipeline
- Conclusion
Introduction
Duration: 5
What you'll learn?
Setup a Jenkins server to run the cicd pipelines
Why is this important?
Important part of MLOps
How it will work?
- Go to Play-with-docker site
- Pull the Jenkins docker
- Run the container
- Access Jenkins GUI and install plugins
- Create a pipeline
- Trigger the pipeline by pushing to git
Who is this for?
- People who are new to MLOps
- People willing to improve CICD skills
Login to PWD
Duration: 5
We will use Play with docker for this tutorial.
Sign-in
Go to this link and login. The landing page will look like this:
Note down the Jenkin URL: http://ip172-18-0-30-c1d37qhbqvp000f2mu60-8080.direct.labs.play-with-docker.com/
Jenkins project types
Duration: 2
Create a new Jenkins job
Duration: 2
Create a new job, name it and select multi-branch as type. Repo might be https://gitlab.com/nanuchi/techworld-js-docker-demo-app/-/tree/jenkins-multi-input
Add git address and credentials
Duration: 2
Create Jenkinsfile
Duration: 2
pipeline {
agent none
stages {
stage('Select micro services') {
input {
message "Select all micro services to deploy"
ok "All selected!"
parameters {
choice(name: 'MS1', choices: ['1.1.0', '1.2.0', '1.3.0'], description: 'input ms')
choice(name: 'MS2', choices: ['1.1.0', '1.2.0', '1.3.0'], description: 'input ms')
choice(name: 'MS3', choices: ['1.1.0', '1.2.0', '1.3.0'], description: 'input ms')
choice(name: 'MS4', choices: ['1.1.0', '1.2.0', '1.3.0'], description: 'input ms')
}
}
steps {
script {
echo "Hello, ${MS1}. Hello, ${MS2}. Hello, ${MS3}. Hello, ${MS4}"
MS1_TO_DEPLOY = MS1
MS2_TO_DEPLOY = MS2
env.MS3_TO_DEPLOY = MS3
env.MS4_TO_DEPLOY = MS4
}
}
}
stage('Select single service') {
input {
message "Select single micro services to deploy?"
parameters {
choice(name: 'MS5', choices: ['1.1.0', '1.2.0', '1.3.0'], description: 'second param with single option')
}
}
steps {
script {
echo "Hello, ${MS5}."
env.MS5_TO_DEPLOY = MS5
echo "${MS1_TO_DEPLOY}"
echo "${MS4_TO_DEPLOY}"
echo "${MS5_TO_DEPLOY}"
}
}
}
}
}
Trigger the pipeline job
Duration: 2
Pipeline can be triggered either by 1) Push notifications, or 2) Polling.